from django import forms
from .models import Conversation2, Message2
from django.contrib.auth import get_user_model

User = get_user_model()

class ConversationForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user')
        super().__init__(*args, **kwargs)
        self.fields['participant2'].queryset = User.objects.exclude(id=self.user.id)

    class Meta:
        model = Conversation2
        fields = ['participant2']

class MessageForm(forms.ModelForm):
    class Meta:
        model = Message2
        fields = ['content']